package com.srb.core.controller.admin;


import com.srb.common.result.R;
import com.srb.core.pojo.entity.UserLoginRecord;
import com.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author dapeng
 * @since 2021-08-08
 */
@Api(tags = {"会员登录日志"})
@Slf4j
//@CrossOrigin
@RestController
@RequestMapping("/admin/core/userLoginRecord")
public class AdminUserLoginRecordController {

    @Autowired
    private UserLoginRecordService userLoginRecordService;

    @ApiOperation(value = "获取会员登录日志列表")
    @GetMapping(value = "/listTop50/{userId}")
    public R listTop50(
            @ApiParam(value = "用户ID",required = true)
            @PathVariable(value = "userId")Long userId){
        List<UserLoginRecord> list = userLoginRecordService.listTop50(userId);
        return R.ok().data("list",list);
    }

}

